import { TestAT } from "../action-types";
import { TestAction } from "../actions";

const initialState = 0;

const testReducer = (state: number = initialState, action: TestAction) => {
  switch (action.type) {
    case TestAT.DEPOSIT:
      return state + action.payload;
    case TestAT.WITHDRAW:
      return state - action.payload;
    case TestAT.BANKRUPT:
      return 0;
    default:
      return state;
  }
};

export default testReducer;
